package com.gaofei.alipay.config;

import org.springframework.context.annotation.Configuration;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */
public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000121699275";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC3hGQJAmcygGa3l4RBI3Zshr+OuVmbWSFOAgPX714eLCXFirsWoVeHLhuTTddpIjdQ3DxAiyEQhE78b61TygORYkJSELhIMPUrnybYPPEy93Qjfm+fidxSQ92LAWWO5haZzvc+p6uthWK9W0Fdw1DrAGnFq709FPe+MrIAwbjbmE09Ka8GSvuyvZnHr/OoZLN7vG5hN542KhtqXPDyLUzFw41Hcdt4vHqOFPqf5IYNVgV1lHWdCxDIRer1Rb5n/OgpgQV7J0w3VCUL+cWATkW61WWTYBuAE/EomJxg6ZqqJ8kD4SN0+LvY8yqS3BnCFl56CSYRc91ToFvnqWive+gDAgMBAAECggEAFt/4vCrBhEj/BLltMdViyIpPTFIMOlH01c1ofz0GBUrJdoMhaOO5jk8P/t+AD0nFjV22YPE2sOFdGxgsibovkaqmy6Xr4ou/s61F4URPaGPx5Q64iTFc9iAheFc3OoWxoYBrzzKFMr7inOnIDxDugCxwAsSydO+tJdcZ2wBKs4xlSYgEyThCB/HSo473vewNsp4MXZ4cDAoUh1qbLkPY4Kp7K5aiRJvF2A5AFxoFI8VtGjBL/z6WQAEEWMZ2y1Fl9X7XIFZCy55wOAOcBN4wfghJnnRzUB2hAMk6mchp7oUguhr26hTh3IOhXPCrnRjRcV+nI9ECoiVWrXPkOVDm+QKBgQDmYocIodFE5Ol2sFQxibAHssUzLBwPHeGzTGVRKibG2HeoseKZ8pjfy5AP7Kw5r8J9JisaLdM1utVTb47E3UeT6Cmk5g7N9wQv2qE1wENE370/KYAV9pf75KDnLQ/wNtm4omu+ZkWfT1hO3lRJcv28Dqv1Rl0KBZLJpmtha/u6twKBgQDL69yVfmwC8u/6bxX1jI1Cf+zD0fiAlKjI2AREl4NukGZA11AVRGQFcJFCZ3DzJx/eMDe+SfBjuvMqkRClcACYIvspU/aU0X5v5eu5Qg7IsPOe8pG3HJYnJH87hEtedTb1zHzKNwm7QIJjGUf1/Al7NaXQ4mZg4pCJzNXO8VwhFQKBgGxHjpO+Ci9JL3k7Mrb9saBMo2aDqsRoFPZCR7Q4DXWTs9mzkX8tiDBW6mSxpdiPBOfxEn0BYK12HGFUo1NfdQ7NJRV9kyO2n18mcHJk5LjwN3ACP1MTTSd0szMz+LO78+RVYjJguwQ/NJAM6qyCwUKr2qIy6fOV3wGrl/h32h5NAoGBAJ9K3YLBwKoFD8T3JZYsduQtfcvxp0b52WcapyrVmEuz7MxV5S7Xv7IoHrBakXa/ZztvOvwgUfH1xaHIs9Inza8KFFxSRFo306ahWiPbICVRZN0S6xS49eoZrnHVg/KDaa1UUV6845Msby3uP7I9cUKXw7GKSSMBmJqsMZB4JdmJAoGBAL9dM5DYoZf6Ud7K2H7Up01p4ocv8ZU96/UiIqV+H2FtgtJ0fXnluiDJEXj6szQoXLCx03HUouOIXrJR90uHk12yi8P3ky2n8/uZRq+ODAwr/ojVwpzHnlcxtgwWnv0fPKKvuOIAB+HHdJsjdCC1Afe11i8qX4mfxPwJdqCYdDqU";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmDfjOG7E6P1bgnwgKog58u1WNGOscWC+sI0hrlD1aS1KI4zupYHYrotZg+7c9VczVTjscrpBZ7eYgCAYMEtMTE0Qais+XLpJQuwAWKfiojWjb34lE62GoT0nlELa1lMjnvjdJRHJVCfpTJ0rKtxMDiZDnMO2Dg9BxWq1tozEUeJo2iZtM+8sCLgwRD2liuOgLyTlNmFafSVqAeERUM0nFjCAbwQtNcK8JmPicSYqS1oOYMve2v6apVSbdEX0Da6ok05y575KAXX1ITEvepz04//g2sfuSXowJv0oysClOYd2iZMHtaKkjMQT5mKA7r4lrdOfRCcAobul7Y7kmmtzzQIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = "http://3h28n78478.oicp.vip:33680/notify";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = "http://127.0.0.1:8080/about";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
//	public static String gatewayUrl = "https://openapi.alipay.com/gateway.do";
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

	// 支付宝网关
	public static String log_path = "D:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
